package com.kjc.demo.basic.listener;

import java.util.Map;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 */
@Slf4j
@Component
public class PaymentOrderCallListener {

    @RabbitListener(queues = {"kjc.queue"})
    public void processPaymentOrderMessage(Message message) {
        byte[] input = message.getBody();
        Map paymentOrderDTO = JSONObject.parseObject(input, Map.class);
        if (paymentOrderDTO == null) {
            log.warn("【订单-消费者】支付请求订单消息:null");
            return;
        }
        log.info("【订单-消费者】支付订单消息：{}", JSONObject.toJSONString(paymentOrderDTO));

    }
}
